package com.itheima.set;

import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

public class Demo01 {

    public static void main(String[] args) {
        Set<String> set= new TreeSet<>();
        set.add("吴亦凡3");
        set.add("吴亦凡3");
        set.add("吴亦凡1");
        set.add("吴亦凡1");
        set.add("吴亦凡2");
        set.add("吴亦凡2");

       /* System.out.println(set);
        set.remove("吴亦凡1");
        System.out.println(set);
        set.clear();
        System.out.println(set);
        System.out.println(set.contains("吴亦凡1"));
        System.out.println(set.contains("吴亦凡2"));
        set.removeIf(x->x.equals("吴亦凡2"));
        System.out.println(set);

        System.out.println(set.isEmpty());
        */
        Iterator<String> iterator = set.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
        for (String s : set) {
            System.out.println(s);
        }

        set.forEach(x-> System.out.println(x));

    }
}
